/**
 * Integer.cpp
 *
 * Version: $Id: Integer.cpp 75 2012-01-02 16:07:53Z s8376@pjwstk.edu.pl $
 */
#include "Integer.h"
#include <iostream>

Integer Integer::operator+(Integer num)
{
    return Integer(m_val + num.m_val);
}
Integer operator-(Integer a, Integer b)
{
    return Integer(a.m_val - b.m_val);
}
Integer Integer::operator-()
{
    return Integer(-m_val);
}

Integer Integer::operator*(Integer val)
{
    return Integer(m_val * val.m_val);
}
Integer Integer::operator/(Integer val)
{
    return Integer(m_val / val.m_val);
}

bool operator==(const Integer& a, const Integer& b)
{
    return (a.m_val == b.m_val) ? true : false;
}

Integer& Integer::operator=(const Integer& ob)
{
    if (this != &ob) {
        //        delete[] name;
        //        name = strdup(ob.name);
        m_val = ob.m_val;
    }
    return *this;
}

ostream& operator<<(ostream& out, const Integer& ob)
{
    out << "Integer: " << ob.m_val;
    return out;
}

istream& operator>>(istream& in, Integer& ob)
{
    in >> ob.m_val;
    return in;
}

Integer& Integer::operator++()
{
    m_val++;
    return *this;
}
Integer& Integer::operator++(int dummy)
{
    m_val++;
    return *this;
}

Integer& operator--(Integer& ob)
{
    ob.m_val--;
    return ob;
}
Integer& operator--(Integer& ob, int dummy)
{
    ob.m_val--;
    return ob;
}
